Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indexer fixes and improvements #758

Merged
merged 40 commits into from
May 16, 2019
Merged

Indexer fixes and improvements #758

merged 40 commits into from
May 16, 2019

Conversation

braydonf
Copy link
Contributor

@braydonf braydonf commented Apr 12, 2019

This adds a new module indexer for indexing blocks, and includes several fixes and improvements:

The following issues are closed:

Includes commits from @tuxcanfly, @braydonf and @nodar-chkuaselidze.

@codecov-io

This comment has been minimized.

@tuxcanfly tuxcanfly mentioned this pull request Apr 13, 2019
3 tasks
@braydonf braydonf added indexer stability / efficiency Denial of service, better resource usage labels Apr 15, 2019
@tynes
Copy link
Member

tynes commented Apr 15, 2019

Could you add migrate/chaindb5to6.js to migrate/latest?

@braydonf
Copy link
Contributor Author

braydonf commented Apr 15, 2019

I'm actually thinking we can combine migrate/chain4to5.js and migrate/chain5to6.js, that will do both. In that we can likely update migrate/latest, from what I remember it's not current.

@braydonf braydonf force-pushed the indexer branch 3 times, most recently from 0f23529 to 2fc8439 Compare April 15, 2019 23:03
@tuxcanfly tuxcanfly mentioned this pull request Apr 16, 2019
3 tasks
@tynes
Copy link
Member

tynes commented Apr 16, 2019

It would be really nice to have some indexer information returned from the API. A call to GET / on the node could return an additional field:

"indexer": {
  "addr": {
      "enabled": true,
      "height": 40000
    },
   "tx" : {
      "enabled": false,
      "height" null
    }
}

As @braydonf pointed out, endpoints will return [] if the indexers are not enabled

If an Indexer has some extra methods that enable this data collection (something like indexer.isEnabled, indexer.bestHeight) and all types of Indexers implement those methods, then this object could be dynamically created and updated if additional indexers are added, ie by plugins.

Would be happy to open an issue if this is out of context for this particular PR

@braydonf braydonf force-pushed the indexer branch 4 times, most recently from 031a939 to 4db8d99 Compare April 16, 2019 23:02
@braydonf
Copy link
Contributor Author

@tynes The indexer status has been added, along with the logging of the current status of the indexer, this should help with checking if the indexing is enabled.

@braydonf braydonf force-pushed the indexer branch 2 times, most recently from c07229b to e61db8c Compare April 17, 2019 17:58
@braydonf braydonf marked this pull request as ready for review April 17, 2019 18:28
@braydonf braydonf added the ready for review Ready to be reviewed label Apr 17, 2019
lib/indexer/records.js Outdated Show resolved Hide resolved
lib/indexer/records.js Outdated Show resolved Hide resolved
lib/indexer/records.js Outdated Show resolved Hide resolved
lib/indexer/records.js Outdated Show resolved Hide resolved
lib/indexer/records.js Outdated Show resolved Hide resolved
braydonf and others added 7 commits May 15, 2019 12:11
There was a rare case that a block could be incorrectly added to
the indexer if the indexer was disabled during a reorg to a height
that matched the height that was expected, and the `sync` method
for the indexer wasn't called that would detect the reorg.
Deprecation details are in CHANGELOG.md
@braydonf
Copy link
Contributor Author

Rebased on latest master branch. Further documentation updates are at bcoin-org/bcoin-org.github.io#145.

Copy link
Member

@tuxcanfly tuxcanfly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

lib/indexer/indexer.js Outdated Show resolved Hide resolved
lib/indexer/indexer.js Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@braydonf braydonf merged commit 6c497d4 into bcoin-org:master May 16, 2019
braydonf added a commit to braydonf/bcoin that referenced this pull request May 16, 2019
@braydonf braydonf deleted the indexer branch May 16, 2019 18:36
@braydonf braydonf removed the ready for review Ready to be reviewed label May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
indexer stability / efficiency Denial of service, better resource usage
Projects
None yet
6 participants